﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Patent.CN;
using Patent.DBUtility;
using Patent.LJ;
using System.Data;
using DevExpress.XtraCharts;
public partial class China_Chart_ChineseApplicantTrendChart : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // Prevent IE Cache
        Response.Expires = 0;
        int topicID = Convert.ToInt32(Session["topicID"].ToString());
        Patent.LJ.Topic topic = new Patent.LJ.Topic(topicID);
        string applicant = Request["applicant"];
        

        if (!string.IsNullOrEmpty(applicant))
        {
            ChinaAnalysis ana = new ChinaAnalysis();
            ana.M_topicTable = topic.InfoTable;

            DataTable dt = ana.GetApplicantTrand(topicID.ToString(), topic.InfoTable, applicant);
            if (dt == null)
            {
                return;
            }

            WebChartCN.Series.Clear();

            Series syxxSeries = new Series("实用新型", ViewType.Spline);
            Series fmzlSeries = new Series("发明专利", ViewType.Spline);
            Series wgsjSeries = new Series("外观设计", ViewType.Spline);
            Series totalSeries = new Series("总计", ViewType.Spline);

            WebChartCN.Series.Add(syxxSeries);
            WebChartCN.Series.Add(fmzlSeries);
            WebChartCN.Series.Add(wgsjSeries);
            WebChartCN.Series.Add(totalSeries);

            syxxSeries.ArgumentDataMember = "年份";
            syxxSeries.ValueDataMembers.AddRange(new string[] { "实用新型" });

            fmzlSeries.ArgumentDataMember = "年份";
            fmzlSeries.ValueDataMembers.AddRange(new string[] { "发明专利" });

            wgsjSeries.ArgumentDataMember = "年份";
            wgsjSeries.ValueDataMembers.AddRange(new string[] { "外观设计" });

            totalSeries.ArgumentDataMember = "年份";
            totalSeries.ValueDataMembers.AddRange(new string[] { "总计" });

            foreach (Series series in WebChartCN.Series)
            {
                series.Label.Visible = false;
                series.DataSource = dt;
                series.ArgumentScaleType = ScaleType.Qualitative;
                series.ValueScaleType = ScaleType.Numerical;
            }
        }
        else
        {
            Response.End();
            Response.Flush();
        }
    }
}
